//
//  NQiyebanshiViewController.m
//  nncloud
//
//  Created by macfai on 2018/11/21.
//  Copyright © 2018 macfai. All rights reserved.
//

#import "NQiyebanshiViewController.h"
#import "NQiyebanshicell.h"
#import "NQiyebanshiCommonViewController.h"

#import "NQiyebanshiNewCell.h"


@interface NQiyebanshiViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSArray *titleArray;

@end

//#define cellIdentifier  @"qiye"


@implementation NQiyebanshiViewController

#define cellIdentifier  @"banshinew"
-(UITableView *)tableView{
    
    if (!_tableView) {
        
        WeakStament(ws);
        
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0 , 0, ScreenWidth , ScreenHeight - 64) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.rowHeight = 550.f;
        _tableView.separatorColor = [UIColor clearColor];
        _tableView.backgroundColor = kBackgroundColor;
//        [_tableView registerNib:[UINib nibWithNibName:@"NQiyebanshiCell" bundle:nil] forCellReuseIdentifier:cellIdentifier];
        [_tableView registerNib:[UINib nibWithNibName:@"NQiyebanshiNewCell" bundle:nil] forCellReuseIdentifier:cellIdentifier];
        //        _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        //                        [ws loadData];
        //        }];
        //        _tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        //            [ws loadMoreData];
        //        }];
        _tableView.showsVerticalScrollIndicator = NO;
        _tableView.tableFooterView = [UIView new];
        
    }
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setItemWithTitle:@"企业办事" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    self.titleArray = @[@"投融资服务",@"信息化服务",@"教育培训服务",@"知识产权",@"商贸流通服务",@"信用评级服务",@"人力资源服务",];
    [self.view addSubview:self.tableView];
}

#pragma mark - delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
//    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
//    switch (indexPath.row) {
//        case 0:
//            qiye.btitle = @"投融资服务";
//            break;
//        case 1:
//            qiye.btitle = @"信息化服务";
//            break;
//        case 2:
//            qiye.btitle = @"教育培训服务";
//            break;
//        case 3:
//            qiye.btitle = @"知识产权服务";
//            break;
//        case 4:
//            qiye.btitle = @"商贸流通服务";
//            break;
//        case 5:
//            qiye.btitle = @"信用评级服务";
//            break;
//        case 6:
//            qiye.btitle = @"人力资源服务";
//            break;
//
//
//        default:
//            break;
//    }
//    [self.navigationController pushViewController:qiye animated:YES];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    //    return self.dataArray.count;
//    return self.titleArray.count;
    
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    NQiyebanshiCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
//    cell.nameLabel.text = self.titleArray[indexPath.row];
//    cell.img.image = WDImgName(self.titleArray[indexPath.row]);
    //在这里timelabel 是detail的显示
    NQiyebanshiNewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionOne:)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionTwo:)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionThree:)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap4 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionFour :)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap5 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionFive:)];
    [cell.TourongziView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap6 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapActionSix:)];
    [cell.TourongziView addGestureRecognizer:tap];
    [cell.infoView addGestureRecognizer:tap1];
    [cell.eduView addGestureRecognizer:tap2];
    [cell.zhishiView addGestureRecognizer:tap3];
    [cell.tradeView addGestureRecognizer:tap4];
    [cell.trustView addGestureRecognizer:tap5];
    [cell.HRView addGestureRecognizer:tap6];
    return cell;
}

///投融资
- (void)tapAction:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
     NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"投融资服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionOne:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"信息化服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionTwo:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"教育培训服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionThree:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"知识产权服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionFour:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"商贸流通服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionFive:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"信用评级服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}
- (void)tapActionSix:(UITapGestureRecognizer *)tap
{
    YYLog(@"touro");
    NQiyebanshiCommonViewController *qiye = [NQiyebanshiCommonViewController new];
    qiye.btitle = @"人力资源服务";
    [self.navigationController pushViewController:qiye animated:YES];
    
}

@end
